home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / DesktopAnimation.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  9KB  |  289 lines

  1. /*
  2.      File:        DesktopAnimation.h
  3.  
  4.      Contains:    Desktop Animation Interfaces.
  5.  
  6.      Version:    Technology:    System 8
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __DESKTOPANIMATION__
  19. #define __DESKTOPANIMATION__
  20.  
  21. #ifndef __APPEARANCE__
  22. #include <Appearance.h>
  23. #endif
  24. #ifndef __CODEFRAGMENTS__
  25. #include <CodeFragments.h>
  26. #endif
  27. #ifndef __COLLECTIONS__
  28. #include <Collections.h>
  29. #endif
  30. #ifndef __DIALOGS__
  31. #include <Dialogs.h>
  32. #endif
  33. #ifndef __DISPLAYS__
  34. #include <Displays.h>
  35. #endif
  36. #ifndef __FILEMANAGERTYPES__
  37. #include <FileManagerTypes.h>
  38. #endif
  39. #ifndef __GXTYPES__
  40. #include <GXTypes.h>
  41. #endif
  42. #ifndef __QDOFFSCREEN__
  43. #include <QDOffscreen.h>
  44. #endif
  45. #ifndef __TEXTOBJECTS__
  46. #include <TextObjects.h>
  47. #endif
  48. #ifndef __TYPES__
  49. #include <Types.h>
  50. #endif
  51.  
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55.  
  56. #if PRAGMA_IMPORT_SUPPORTED
  57. #pragma import on
  58. #endif
  59.  
  60. #if PRAGMA_ALIGN_SUPPORTED
  61. #pragma options align=mac68k
  62. #endif
  63.  
  64. #if FOR_SYSTEM8_COOPERATIVE
  65. /* Gestalt selectors to tell if DAM is installed #### Move to Gestalt.i later */
  66.  
  67. enum {
  68.     gestaltDesktopAnimationMgr    = 'danm',
  69.     gestaltDesktopAnimationMgrPresent = 0                        /* If bit set then DAM is present*/
  70. };
  71.  
  72. /* Desktop Animation module file resources */
  73.  
  74. enum {
  75.     kDesktopAnimModuleFileType    = 'damm',
  76.     kDesktopAnimListRsrcType    = 'giz#',
  77.     kDesktopAnimListRsrcVers    = 0,
  78.     kDesktopAnimListRsrcID        = 128,
  79.     kDesktopAnimFirstRsrcID        = 8192,
  80.     kDesktopAnimLastRsrcID        = 16383
  81. };
  82.  
  83. /* Properties relating to the DesktopAnimPanel */
  84.  
  85. enum {
  86.     kDesktopAnimPanelPropertyTag = 'ptag',
  87.     kDesktopAnimPanelUndoTextTag = 'utxt',
  88.     kDesktopAnimPanelValueToggleTag = 'vtog'
  89. };
  90.  
  91. /* Desktop Animation info values */
  92.  
  93. enum {
  94.     kDesktopAnimModuleInfoVers    = 0,
  95.     kDesktopAnimModuleInfoShareAny = 0
  96. };
  97.  
  98. /* DesktopAnimFlags */
  99.  
  100. enum {
  101.     kDesktopAnimDesktop            = 0x00000001,
  102.     kDesktopAnimBackground        = 0x00000002,                    /* No drawing behind this module*/
  103.     kDesktopAnimScreenSaver        = 0x00000004,
  104.     kDesktopAnimCanShareWindow    = 0x00000008,
  105.     kDesktopAnimAllDisplays        = 0x00000010,
  106.     kDesktopAnimIsSharingWindow    = 0x00000020,                    /* If called as part of multiple modules*/
  107.     kDesktopAnimUnfadeOnKeyboard = 0x00000040,                    /* ScreenSaver only*/
  108.     kDesktopAnimUnfadeOnMouseMotion = 0x00000080,                /* ScreenSaver only*/
  109.     kDesktopAnimOwnsColorPalette = 0x00000100,                    /* ScreenSaver only*/
  110.     kDesktopAnimRequestTerminate = 0x00000200,                    /* ScreenSaver output only*/
  111.     kDesktopAnimDrawingOffscreen = 0x00000400,                    /* Should be set when asking a module to draw to an offscreen*/
  112.                                                                 /* Flags that indicate what mode we are running in*/
  113.     kDesktopAnimModeFlags        = kDesktopAnimDesktop | kDesktopAnimBackground | kDesktopAnimScreenSaver, /* Flags we determine at runtime when initializing/running a module*/
  114.     kDesktopAnimRuntimeFlags    = kDesktopAnimModeFlags | kDesktopAnimIsSharingWindow | kDesktopAnimAllDisplays | kDesktopAnimOwnsColorPalette | kDesktopAnimRequestTerminate | kDesktopAnimDrawingOffscreen
  115. };
  116.  
  117. typedef UInt32 DesktopAnimFlags;
  118. /* Pre-defined Desktop Animation property tags */
  119.  
  120. enum {
  121.     kDesktopAnimDisplayRgnTag    = 'drgn',
  122.     kDesktopAnimDisplayDepthTag    = 'dpth'
  123. };
  124.  
  125. /* Error codes (will be moved to Error.i when we have an assigned range) */
  126.  
  127. enum {
  128.     kDesktopAnimModuleNotFoundErr = -3000,
  129.     kDesktopAnimServerNotFoundErr = -3001,
  130.     kDesktopAnimDrawNotFoundErr    = -3002,
  131.     kDesktopAnimPanelNotFoundErr = -3003,
  132.     kDesktopAnimDrawInitErr        = -3004,
  133.     kDesktopAnimDrawPanelErr    = -3005,
  134.     kDesktopAnimBadScreenSaverErr = -3006,
  135.     kDesktopAnimScreenSaverInternalErr = -3007,
  136.     kDesktopAnimItemNotModuleErr = -3008,
  137.     kDesktopAnimNoQuickdrawGXErr = -3009,
  138.     kDesktopAnimBadDesktopAnimModuleDescRefErr = -3010,
  139.     kDesktopAnimUnknownModuleListVersErr = -3011,
  140.     kDesktopAnimUnknownModuleInfoVersErr = -3012,
  141.     kDesktopAnimUnknownPatternListVersErr = -3013,
  142.     kDesktopAnimIllegalDesktopAnimationStatusErr = -3014,
  143.     kDesktopAnimModuleNameTooLongErr = -3015,
  144.     kDesktopAnimOffscreenLockPixelsErr = -3016,
  145.     kDesktopAnimQuickdrawGXErr    = -3017
  146. };
  147.  
  148. /* Desktop Pattern Support */
  149.  
  150. enum {
  151.     kDesktopPatternListRsrcType    = 'dtp#',
  152.     kDesktopPatternListRsrcVers    = 0,
  153.     kDesktopPatternListRsrcID    = 128
  154. };
  155.  
  156. /* Reasons Screen Saver wants to unfade */
  157.  
  158. enum {
  159.     kScreenSaverUnfadeUnknown    = 0,
  160.     kScreenSaverUnfadeKeyboard    = 1,
  161.     kScreenSaverUnfadeMouseMotion = 2,
  162.     kScreenSaverUnfadeByRequest    = 3,
  163.     kScreenSaverUnfadeSelfRequest = 4
  164. };
  165.  
  166. typedef SInt32 ScreenSaverUnfadeType;
  167. /* The drawing surfaces record */
  168. struct DesktopAnimGraphicsPorts {
  169.     CGrafPtr                         drawPort;
  170.     gxViewPort                         gxDrawPort;
  171. };
  172. typedef struct DesktopAnimGraphicsPorts DesktopAnimGraphicsPorts;
  173.  
  174. /* Offscreen drawing record */
  175. struct DesktopAnimOffscreenGraphicsPorts {
  176.     GWorldPtr                         offGWorld;
  177.     gxViewPort                         offGXDrawPort;
  178.     gxViewDevice                     offGXViewDevice;
  179.     gxViewGroup                     offGXViewGroup;
  180. };
  181. typedef struct DesktopAnimOffscreenGraphicsPorts DesktopAnimOffscreenGraphicsPorts;
  182.  
  183. /* Info record for modules when created/opened */
  184. struct DesktopAnimModuleInfo {
  185.     SInt32                             version;
  186.     DesktopAnimFlags                 moduleFlags;
  187.     OSType                             shareWithSignature;
  188. };
  189. typedef struct DesktopAnimModuleInfo DesktopAnimModuleInfo;
  190.  
  191. /* Info record for Desktop Animation list resource (kDesktopAnimListRsrcType) */
  192. struct DesktopAnimModuleListInfo {
  193.     SInt16                             itemListID;
  194.     SInt16                             textObjectListID;
  195.     SInt16                             byLineIndex;
  196.     SInt16                             moduleNameIndex;
  197.     DesktopAnimModuleInfo             moduleInfo;
  198.     Str63                             desktopAnimPanelHandler;
  199.     Str63                             desktopAnimDrawHandler;
  200. };
  201. typedef struct DesktopAnimModuleListInfo DesktopAnimModuleListInfo;
  202.  
  203. /* The Desktop Animation list resource (kDesktopAnimListRsrcType) */
  204. struct DesktopAnimModuleListRsrcRec {
  205.     SInt32                             version;
  206.     Str63                             desktopAnimServerHandler;
  207.     SInt32                             modulesCnt;
  208.     DesktopAnimModuleListInfo         modules[1];
  209. };
  210. typedef struct DesktopAnimModuleListRsrcRec DesktopAnimModuleListRsrcRec;
  211.  
  212. typedef DesktopAnimModuleListRsrcRec *DesktopAnimModuleListRsrcPtr;
  213. typedef DesktopAnimModuleListRsrcPtr *DesktopAnimModuleListRsrcHandle;
  214. /* Desktop Pattern Record */
  215. struct DesktopPattern {
  216.     SInt16                             ppatRsrcID;
  217.     SInt16                             nameListID;
  218.     SInt16                             nameListIndex;
  219. };
  220. typedef struct DesktopPattern DesktopPattern;
  221.  
  222. /* Desktop Pattern List resource (kDesktopPatternListRsrcType) */
  223. struct DesktopPatternListRsrcRec {
  224.     SInt16                             version;
  225.     SInt16                             pattCnt;
  226.     DesktopPattern                     patterns[1];
  227. };
  228. typedef struct DesktopPatternListRsrcRec DesktopPatternListRsrcRec;
  229.  
  230. typedef DesktopPatternListRsrcRec *DesktopPatternListRsrcPtr;
  231. typedef DesktopPatternListRsrcPtr *DesktopPatternListRsrcHandle;
  232. #endif
  233. #if FOR_SYSTEM8_PREEMPTIVE
  234. /* Desktop Animation Module type */
  235.  
  236. enum {
  237.     kItemIsBackground            = 0x0001,
  238.     kItemIsModule                = 0x0002,
  239.     kItemIsPattern                = 0x0003,
  240.     kItemIsNoModule                = 0x0004                        /* Used internally*/
  241. };
  242.  
  243. typedef SInt16 DesktopAnimItemType;
  244. /* Desktop Animation status */
  245.  
  246. enum {
  247.     kDesktopAnimationTurnedOn    = 0x00000001,                    /* Desktop animation is on*/
  248.     kScreenSaverTurnedOn        = 0x00000002,                    /* Screen saving is turned on*/
  249.     kScreenSaverAsleep            = 0x00000004,                    /* Currently in screen saving mode*/
  250.     kScreenSaverDemoMode        = 0x00000008                    /* Screen saving demo mode (read only)*/
  251. };
  252.  
  253. typedef UInt32 DesktopAnimationStatusType;
  254. /* Module description reference */
  255. typedef struct OpaqueDesktopAnimModuleDescRef* DesktopAnimModuleDescRef;
  256. /* Desktop Animation Manager API */
  257. extern OSStatus GetDesktopAnimationDesktopPatternsFileRef(FSObjectRef *pattFileRef);
  258.  
  259. extern void GetDesktopAnimationStatus(DesktopAnimationStatusType *status);
  260.  
  261. extern OSStatus SetDesktopAnimationStatus(DesktopAnimationStatusType status);
  262.  
  263. extern OSStatus NewDesktopAnimationModuleDescRef(TextObject itemName, FSObjectRef itemFile, SInt32 itemID, DesktopAnimItemType itemType, DesktopAnimModuleDescRef *moduleDescRef);
  264.  
  265. extern OSStatus CloneDesktopAnimationModuleDescRef(DesktopAnimModuleDescRef moduleDescRef);
  266.  
  267. extern Boolean EquivalentDesktopAnimationModuleDescRefs(DesktopAnimModuleDescRef moduleADescRef, DesktopAnimModuleDescRef moduleBDescRef);
  268.  
  269. extern OSStatus GetDesktopAnimationModuleDescInfo(DesktopAnimModuleDescRef moduleDescRef, TextObject itemName, FSObjectRef *itemFile, SInt32 *itemID, DesktopAnimItemType *itemType);
  270.  
  271. extern OSStatus DisposeDesktopAnimModuleDescRef(DesktopAnimModuleDescRef moduleDescRef);
  272.  
  273. #endif
  274.  
  275. #if PRAGMA_ALIGN_SUPPORTED
  276. #pragma options align=reset
  277. #endif
  278.  
  279. #if PRAGMA_IMPORT_SUPPORTED
  280. #pragma import off
  281. #endif
  282.  
  283. #ifdef __cplusplus
  284. }
  285. #endif
  286.  
  287. #endif /* __DESKTOPANIMATION__ */
  288.  
  289.